package com.lyf.scm.common.enums;

/**
 * 渠道枚举
 *
 * @author huangtao
 */
public enum ChannelTypeEnum {

    /**
     * 门店-直营
     */
    DIRECTLY_OPERATE("C00001", "门店-直营"),
    /**
     * 门店-加盟
     */
    JOIN_IN("C00002", "门店-加盟"),
    /**
     * 云商
     */
    CLOUD_BUSINESS("C00003", "云商"),
    /**
     * APP
     */
    APP("C00004", "APP"),
    /**
     * 经销商
     */
    DEALER("C00005", "经销中心"),
    /**
     * 团购
     */
    GROUP_BUYING("C00006", "团购");

    private String code;

    private String desc;

    ChannelTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 通过渠道CODE获取渠道名称
     *
     * @param code
     * @return {@link String}
     **/
    public static String getNameByCode(String code) {
        for (ChannelTypeEnum channelTypeEnum : ChannelTypeEnum.values()) {
            if (channelTypeEnum.getCode().equals(code)) {
                return channelTypeEnum.getDesc();
            }
        }
        return "";
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
